﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Voucher.ascx.cs" Inherits="PayrollHR.Administration.Modules.VoucherControl" %>
<%@ Register Src="VoucherSearch.ascx" TagName="VoucherSearch" TagPrefix="uc1" %>
<script type="text/javascript">
    $(window).bind('load', function () {
        var cbHeader = $(".cbHeader input");
        var cbRowItem = $(".cbRowItem input");
        cbHeader.bind("click", function () {
            cbRowItem.each(function () { this.checked = cbHeader[0].checked; })
        });
        cbRowItem.bind("click", function () { if ($(this).checked == false) cbHeader[0].checked = false; });
    });
</script>
<asp:UpdatePanel ID="upFormCustomer" runat="server">
    <ContentTemplate>
        <div class="section-header">
            <div class="title">
                <img src="Common/ico-customers.png" alt="Danh sách hóa đơn" />
                Danh sách hóa đơn
            </div>
            <div class="options">
                <asp:HyperLink runat="server" Visible="False" ID="hlexport" ForeColor="#6600CC">[hlexport]</asp:HyperLink>
                <asp:Button runat="server" Text="Đổi trạng thái"
                    CssClass="adminButtonBlue" ID="btnLock" OnClick="btnLock_Click" 
                    ToolTip="Đổi trạng thái" /> 
                 <asp:Button ID="btnExport" runat="server" Text="Export template"
                    CssClass="adminButtonBlue"  ToolTip="Filter" OnClick="btnExport_Click" /> 
                <asp:Button ID="SearchButton" runat="server" Text="Filter"
                    CssClass="adminButtonBlue" OnClick="SearchButton_Click" ToolTip="Filter" />          
                <asp:Button runat="server" Text="Delete"
                    CssClass="adminButtonBlue" ID="btnDelete" OnClick="btnDelete_Click" ValidationGroup="ExportXLS"
                    ToolTip="Delete Customer" />                       
                <input type="button" onclick="location.href = 'VoucherAdd.aspx'" value="Thêm mới hóa đơn"
                    id="btnAddNew" class="adminButtonBlue" title="Thêm mới hóa đơn" />
                <input type="button" onclick="location.href = 'VoucherImport.aspx'" value="Import"
                    id="Button1" class="adminButtonBlue" title="import" />
            </div>
        </div>
        <div>
            <uc1:VoucherSearch Visible="true" ID="ctrVoucherSearch" runat="server" />
        </div>
        <p></p>
        <asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="False" Width="100%" DataKeyNames="VoucherID"
            OnPageIndexChanging="gvCustomers_PageIndexChanging" CellPadding="4" AllowPaging="True"  ViewStateMode="Enabled"
            PageSize="20">
            <Columns>
                <asp:TemplateField ItemStyle-Width="0.5%" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        <asp:CheckBox ID="cbSelectAll" runat="server" CssClass="cbHeader" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="cbVoucherInfo" runat="server" CssClass="cbRowItem" ToolTip="<% $PayrollResources:Admin.Customers.CustName.ToolTip %>" />
                        <asp:HiddenField ID="hfVoucherID" runat="server" Value='<%# Eval("VoucherID") %>' />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="0.5%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã số thuế" ItemStyle-Width="7%">
                    <ItemTemplate>
                        <asp:HyperLink ID="ActionHyperLink" runat="server" ToolTip="Click vào mã số thuế để xem chi tiết" 
                            Text='<%# Eval("Taxcode") %>' NavigateUrl='<%# String.Format("../VoucherAdd.aspx?VoucherID={0}", Eval("VoucherID")) %>'  />                        
                    </ItemTemplate>
                    <ItemStyle Width="7%" />
                </asp:TemplateField>
                  <asp:TemplateField HeaderText="Tên doanh nghiệp" ItemStyle-Width="20%">
                    <ItemTemplate>     
                        <%#Server.HtmlEncode(Eval("CompanyName").ToString())%>               
                    </ItemTemplate>
                    <ItemStyle Width="20%" />
                </asp:TemplateField>
                 <asp:TemplateField HeaderText="Address"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="22%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("Address").ToString())%>                        
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" />
                    <ItemStyle HorizontalAlign="Left" Width="22%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Gói cước"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("PacketName").ToString())%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="10%" />
                </asp:TemplateField>
               <asp:TemplateField HeaderText="Hóa đơn do ai xuất"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("OwnerName") != null ? Eval("OwnerName").ToString() : "")%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="20%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Nhà cung cấp"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="12.5%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("Vendor").ToString())%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="13.5%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Trạng thái"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="8%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("Status").ToString())%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="8%" />
                </asp:TemplateField>
            </Columns>
            <PagerSettings PageButtonCount="50" Position="TopAndBottom" />
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="up1" runat="server" AssociatedUpdatePanelID="upFormCustomer">
    <ProgressTemplate>
        <div class="progress">
            <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/UpdateProgress.gif"
                AlternateText="update" />
            <%=GetLocaleResourceString("Admin.Common.Wait...")%>
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>